package com.agan.workflow.service.impl;

import java.util.List;
import com.agan.common.core.utils.DateUtils;
import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import com.agan.workflow.mapper.BpmDefinitionMapper;
import com.agan.workflow.domain.BpmDefinition;
import com.agan.workflow.service.IBpmDefinitionService;

/**
 * 流程定义Service业务层处理
 * 
 * @author agan
 * @date 2024-01-11
 */
@Service
@RequiredArgsConstructor
public class BpmDefinitionServiceImpl implements IBpmDefinitionService 
{
    private final BpmDefinitionMapper bpmDefinitionMapper;

    /**
     * 查询流程定义
     * 
     * @param defId 流程定义主键
     * @return 流程定义
     */
    @Override
    public BpmDefinition selectBpmDefinitionByDefId(Long defId)
    {
        return bpmDefinitionMapper.selectBpmDefinitionByDefId(defId);
    }

    /**
     * 查询流程定义列表
     * 
     * @param bpmDefinition 流程定义
     * @return 流程定义
     */
    @Override
    public IPage<BpmDefinition> selectBpmDefinitionList(BpmDefinition bpmDefinition)
    {
        return bpmDefinitionMapper.selectBpmDefinitionList(bpmDefinition);
    }

    /**
     * 新增流程定义
     * 
     * @param bpmDefinition 流程定义
     * @return 结果
     */
    @Override
    public int insertBpmDefinition(BpmDefinition bpmDefinition)
    {
        bpmDefinition.setCreateTime(DateUtils.getNowDate());
        return bpmDefinitionMapper.insertBpmDefinition(bpmDefinition);
    }

    /**
     * 修改流程定义
     * 
     * @param bpmDefinition 流程定义
     * @return 结果
     */
    @Override
    public int updateBpmDefinition(BpmDefinition bpmDefinition)
    {
        bpmDefinition.setUpdateTime(DateUtils.getNowDate());
        return bpmDefinitionMapper.updateBpmDefinition(bpmDefinition);
    }

    /**
     * 批量删除流程定义
     * 
     * @param defIds 需要删除的流程定义主键
     * @return 结果
     */
    @Override
    public int deleteBpmDefinitionByDefIds(Long[] defIds)
    {
        return bpmDefinitionMapper.deleteBpmDefinitionByDefIds(defIds);
    }

    /**
     * 删除流程定义信息
     * 
     * @param defId 流程定义主键
     * @return 结果
     */
    @Override
    public int deleteBpmDefinitionByDefId(Long defId)
    {
        return bpmDefinitionMapper.deleteBpmDefinitionByDefId(defId);
    }
}
